/*
 * MyPlot.cpp
 *
 *  Created on: 2009-07-19
 *      Author: dziki_rysio_997
 */

#include "MyPlot.h"

#include "dogz/ObservationManager.h"
#include "dogz/OutputWriterFactory.h"
#include <QString>
#include <qwt_plot.h>

MyPlot::MyPlot(QString starName, int obsCount, double magMin, double magMax, double JD1, double JD2, QWidget *parent=0, bool fazowy=false, double T0=0.0, double P=0.0) : QwtPlot( parent)
{
    if (!fazowy){
    	setTitle( QString("%1, %2 obserwacji od %3 do %4.").arg(starName)
    			.arg(obsCount).arg(JD1, 0, 'f').arg(JD2, 0, 'f'));
    	setAxisTitle( xBottom, "JD" );
    }
    else {
    	setTitle( QString("Wykres fazowy - %1, %2 obserwacji od %3 do %4, T0=%5, P=%6.").arg(starName)
    	    	.arg(obsCount).arg(JD1, 0, 'f').arg(JD2, 0, 'f').arg(T0, 0, 'f').arg(P, 0, 'f'));
    	setAxisScale(xBottom, 0, 1.5);
    	setAxisTitle( xBottom, "P" );
    }
    setAxisTitle( yLeft, "mag" );

    setAxisScale(yLeft, magMin+(magMin-magMax)/10, magMax-(magMin-magMax)/10);

    setCanvasBackground(QColor("white"));

    replot();
}
